<?php
define('MODULE_NAME','site');
$actions = array('index','show','go','submit','save');
$managers = array('center','top','menu','password','repwd','siteinfo','siteupdate','auction','adv','goods','money','score','statistic','getstatistic','recharge','rechargehandle');
$action = 'index';

if(isset($_REQUEST['action']))
{
	$action = strtolower($_REQUEST['action']);
	if(!in_array($action,$actions) && !in_array($action,$managers))
		$action = 'index';
}
	
define('ACTION_NAME',$action);
require_once './core/service/fanwe.service.php';
$fanwe = &FanweService::instance();
$managers = array('center','top','menu','password','repwd','siteinfo','siteupdate','auction','adv','goods','money','score','statistic','getstatistic','recharge','rechargehandle');
if(ACTION_NAME == 'index')
{
	$fanwe->cache_list[] = 'site';
	$fanwe->cache_list[] = 'site_cate';
}
elseif(ACTION_NAME == 'submit' || ACTION_NAME == 'save')
{
	$fanwe->cache_list[] = 'site_cate';
}
elseif(ACTION_NAME == 'show' || ACTION_NAME == 'go')
{
	$fanwe->cache_list[] = 'site';
}
else
	$fanwe->cache_list = array();

if(ACTION_NAME == 'go')
	$fanwe->is_user = false;

if(!in_array(ACTION_NAME,$managers))
	$fanwe->is_group_city = true;

$fanwe->initialize();

if(in_array(ACTION_NAME,$managers))
{
	if (intval($_FANWE['user']['id']) <= 0)
	{
		fHeader("location: ".U('user/login'));
		exit;
	}
	
	if ($_FANWE['user']['group_type'] == 'User')
	{
		fHeader("location: ".U('user/center'));
		exit;
	}
}

if(ACTION_NAME == 'index')
{
	loadCache('city_site_'.CURRENT_CITY_PY);
}

require import('module/site');

switch(ACTION_NAME)
{
	case 'index':
		SiteModule::index();
	break;
	
	case 'show':
		SiteModule::show();
	break;
	
	case 'go':
		SiteModule::go();
	break;
	
	case 'submit':
		SiteModule::submit();
	break;
	
	case 'save':
		SiteModule::save();
	break;
	
	case 'center':
		SiteModule::center();
	break;
	
	case 'top':
		SiteModule::top();
	break;
	
	case 'menu':
		SiteModule::menu();
	break;
	
	case 'siteinfo':
		SiteModule::siteInfo();
	break;
	
	case 'siteupdate':
		SiteModule::siteUpdate();
	break;
	
	case 'password':
		SiteModule::password();
	break;
	
	case 'repwd':
		SiteModule::repwd();
	break;
	
	case 'recharge':
		SiteModule::recharge();
	break;
	
	case 'rechargehandle':
		SiteModule::rechargeHandle();
	break;
	
	case 'money':
		SiteModule::money();
	break;
	
	case 'score':
		SiteModule::score();
	break;
	
	case 'auction':
		SiteModule::auction();
	break;
	
	case 'statistic':
		SiteModule::statistic();
	break;
	
	case 'getstatistic':
		SiteModule::getStatistic();
	break;
	
	case 'goods':
		SiteModule::goods();
	break;
}
?>